//获取cookie
getCookie = (name)=>{
    let arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}
//设置cookie
setCookie=(name, value)=> {
    let Days = 30;
    let exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + unescape(value) + ";expires=" + exp.toGMTString() + ";path=/";
}
//删除cookie
delCookie = (name)=> { //为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
    let exp = new Date();
    exp.setTime(exp.getTime() - 10000);
    document.cookie = name + "=a; expires=" + exp.toGMTString() + ";path=/";
}
export default handleCookie;
